/*================================================================================
*
*
*                                   
*
*
* 项目名称: mcp2515-spi-can-demo
* 文件名称: LCD.h
* 创建日期: 21-01-15
* 文件描述: 
*
================================================================================*/
#ifndef LCD_H_
#define LCD_H_

typedef struct tagColorBlock
{
    uint16_t u16X;
    uint16_t u16Y;
    uint16_t u16Width;
    uint16_t u16Height;
    uint16_t u16RGB;
    char *pStr;
}ColorBlock_t;

typedef struct 
{
    int16_t x;
    int16_t y;
    int16_t pre_x;
    int16_t pre_y;
}
stType_XPT2046_Coordinate;

typedef struct
{
    float dX_X;
    float dX_Y;
    float dX;
    float dY_X;
    float dY_Y;
    float dY;
}
stType_XPT2046_TouchPara;

//- RGB565 color definitions---------------------
#define BLACK                       0x0000 //黑色
#define NAVY                        0x000F //深蓝色
#define DGREEN                      0x03E0 //深绿色
#define DCYAN                       0x03EF //深青色
#define MAROON                      0x7800 //深红色
#define PURPLE                      0x780F //紫色
#define OLIVE                       0x7BE0 //橄榄绿
#define LGRAY                       0xC618 //灰白色
#define DGRAY                       0x7BEF //深灰色
#define BLUE                        0x001F //蓝色
#define GREEN                       0x07E0 //绿色
#define CYAN                        0x07FF //青色
#define RED                         0xF800 //红色
#define MAGENTA                     0xF81F //品红
#define YELLOW                      0xFFE0 //黄色
#define WHITE                       0xFFFF //白色

//-XPT2046 definations---------------------------
#define TOUCH_PRESSED               1
#define TOUCH_NOT_PRESS             0

#define COLOR_BAR_WIDTH             276
#define COLOR_BAR_HEIGHT            20

extern stType_XPT2046_TouchPara strXPT2046_TouchPara[];

extern void InitLcd(void);
extern void LcdBlCtrl(uint8_t u8State);
extern void LcdDrawColorBlock(const ColorBlock_t *pColBk);
void LcdDrawColorBar(uint16_t u16X, uint16_t u16Y, uint8_t u8Val, uint16_t u16RGB);
uint8_t XPT2046_Get_TouchedPoint(stType_XPT2046_Coordinate* pDisplayCoordinate, stType_XPT2046_TouchPara* pTouchPar);
uint8_t XPT2046_TouchDetect(void);
void XPT2046_TouchEventHandler(void);

#endif
